/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cms.action;

import cms.sessionbean.ConferenceItemApplicationRemote;
import cms.util.EjbLocator;
import com.opensymphony.xwork2.ActionSupport;
import dto.Conference;
import dto.Conferenceitem;
import java.util.List;
import model.ConferenceListDisplayModel;
import model.ConferenceModel;

/**
 *
 * @author Gary
 */
// ri ri ri ri ri, zhe ge ation mei yong
public class ConferenceItemAction  extends ActionSupport{
    private Conference conference;
    private List<ConferenceListDisplayModel> displayItems; 
    private String conferenceName; 
    private List<Conferenceitem> items;
    
    public String getConferenceName() {
        return conferenceName;
    }

    public void setConferenceName(String conferenceName) {
        this.conferenceName = conferenceName;
    }

    public List<ConferenceListDisplayModel> getDisplayItems() {
        return displayItems;
    }

    public void setDisplayItems(List<ConferenceListDisplayModel> displayItems) {
        this.displayItems = displayItems;
    }
    public Conference getConference() {
        return conference;
    }

    public void setConference(Conference conference) {
        this.conference = conference;
    }

    public List<Conferenceitem> getItems() {
        return items;
    }

    public void setItems(List<Conferenceitem> items) {
        this.items = items;
    }
    
    
    public ConferenceItemAction() {
    }
    
    public String execute() throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    // get conference and list the items of the conference
    public String listItem(){
        ConferenceItemApplicationRemote cb = (ConferenceItemApplicationRemote)EjbLocator.getInstance().LookUpBeanByName(ConferenceItemApplicationRemote.class, "ConferenceItemApplication");
        items=cb.getConfercenItemsByConferenceName("conferenceName");
        
        // dummy data
//        conference = new Conference("ConferenceToParticipate", "Siminar", "Sands Hotel", true, null, true, 99.90, 128);
//        items = new ArrayList<Conferenceitem>();
//        for (int i = 0; i < 10; i++) {
//            ConferenceitemId id = new ConferenceitemId(conference.getConferenceName(), "ItemName"+i);
//            Conferenceitem ci = new Conferenceitem(id);
//            ci.setItemDescription("ri description of item " + i);
//            ci.setCategory(i/4);
//            ci.setFilePath("filepath of item " + i);
//            ci.setStatus(0);
//            ci.setIsBlindReivew(false);
//            items.add(ci);
//        }
        displayItems = ConferenceModel.ConverModelList(items);
        return "itemlist";
    }
}
